package com.wxmit.ot.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * YseOrNoEnum
 *
 * @author huangxiong
 * @version V1.0
 * @date 2023/2/23 17:05
 */
@Getter
public enum YesOrNoEnum {
    YSE("0","是",true),
    NO("1","否",false);

    public final String code;
    public final String label;
    public final Boolean value;

    YesOrNoEnum(String code, String label, Boolean value){
        this.code = code;
        this.label = label;
        this.value = value;
    }

    public static Boolean getBooleanByCode(String code){
        for(YesOrNoEnum item : values()){
            if(Objects.equals(item.code,code)){
                return item.value;
            }
        }
        return NO.value;
    }
}
